package com.yaxin.gallery;

import android.os.Bundle;
import android.support.v4.app.Fragment;
import android.support.v4.app.FragmentActivity;
import android.support.v4.view.ViewPager;
import android.view.Window;
import android.view.WindowManager;
import android.widget.TextView;

import java.util.ArrayList;


/**
 * @author Administrator 引导页
 */
public class GuideActivity extends FragmentActivity
{
    String TAG = "GuideActivity";
    ViewPager viewPager;
    TextView tv_dot_dynamic;

    @Override
    protected void onCreate(Bundle savedInstanceState)
    {
        super.onCreate(savedInstanceState);
        try
        {
            requestWindowFeature(Window.FEATURE_NO_TITLE);
            getWindow().setFlags(WindowManager.LayoutParams.FLAG_FULLSCREEN,
                    WindowManager.LayoutParams.FLAG_FULLSCREEN);
            setContentView(R.layout.guide);
            initView();
            initData();
        } catch (Exception e)
        {
        }
    }


    int count = 0;
    int currentPosition = 0;
    int oldPosition = 0;

    private void initData()
    {
        ArrayList<Fragment> listFragments = new ArrayList<Fragment>();
        Fragment_guide_1 fragment_guide_1 = new Fragment_guide_1();
        Fragment_guide_2 fragment_guide_2 = new Fragment_guide_2();
        Fragment_guide_3 fragment_guide_3 = new Fragment_guide_3();
        listFragments.add(fragment_guide_1);
        listFragments.add(fragment_guide_2);
        listFragments.add(fragment_guide_3);
//        GuideFragmentPagerAdapter adapter = new GuideFragmentPagerAdapter(
//                getSupportFragmentManager(), listFragments);
        ArrayList<Integer> list = new ArrayList<>();
        list.add(R.mipmap.guide_1);
        list.add(R.mipmap.guide_2);
        list.add(R.mipmap.guide_3);
        list.add(R.mipmap.guide_1);
        list.add(R.mipmap.guide_2);
        list.add(R.mipmap.guide_3);
        list.add(R.mipmap.guide_1);
        list.add(R.mipmap.guide_2);
        list.add(R.mipmap.guide_3);
        GuidePagerAdapter adapter = new GuidePagerAdapter(this, list);
//        GuidePagerAdapter adapter=new GuidePagerAdapter(this,listFragments);
//        viewPager.setPageMargin(80);
//		viewPager.setPageTransformer(true, new MyPageTransformer());
//		viewPager.setPageTransformer(true, new AlphaPageTransformer());
//		viewPager.setPageTransformer(true, new RotatePageTransformer());
//		viewPager.setPageTransformer(true, new DepthPageTransformer());
//		viewPager.setPageTransformer(true, new ZoomOutPageTransformer());
        viewPager.setPageTransformer(true, new CustomPageTransformer());
        viewPager.setOffscreenPageLimit(2);
        viewPager.setAdapter(adapter);
        viewPager.setCurrentItem(Integer.MAX_VALUE / 2 - list.size());
    }


    private void initView()
    {
        viewPager = (ViewPager) findViewById(R.id.viewPager);
    }
}
